import java.util.Scanner;

public class LoadContral {
    //自定义用户名异常
    public static class UserNameException extends RuntimeException{
        public UserNameException(String message) {
            super(message);
        }
    }
    //自定义用户密码异常
    public static class UserpasswordExpetion extends RuntimeException{
        public UserpasswordExpetion(String message) {
            super(message);
        }
    }
    //登录类
    public static class Login{
        private final String userName = "admin";
        private final String passWord = "123456";
        public void loginIn(String userName, String passWord) throws UserNameException,UserpasswordExpetion{
            if(!(this.userName.equals(userName))){
                throw new UserNameException("用户名错误！");
            } else if (!(this.passWord.equals(passWord))) {
                throw new UserpasswordExpetion("密码错误！");
            }else{
                System.out.println("登陆成功！");
            }
        }
    }

    public static void main(String[] args) {
        try {
            Login login = new Login();
            Scanner scanner = new Scanner(System.in);
            String userName = scanner.next();
            String passWord = scanner.next();
            login.loginIn(userName, passWord);
        }catch(UserNameException e){
            //打印异常信息
            e.printStackTrace();
        }catch(UserpasswordExpetion e){
            e.printStackTrace();
        }
    }
}
